<!DOCTYPE html>
<html class="app fadeInUp animated js no-touch no-android no-chrome firefox no-iemobile no-ie no-ie10 no-ie11 no-ios" lang="cn">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="<?php echo e(url('/')); ?>/base/css/jstree.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta content="" name="Keywords">
<meta content="" name="Description">
<meta name="renderer" content="webkit">
<meta name="csrf-token" content="<?php echo e(csrf_token()); ?>" />
<?php echo $__env->make('back.public.header', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<link rel="stylesheet" href="<?php echo e(url('/')); ?>/layer/skin/layer.css" />
<script src="<?php echo e(url('/')); ?>/layer/layer.js"></script>
<script>
	$.ajaxSetup({
		headers: {
			'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
		}
	});
	var xhr;
	var returnimg="";
	var returninput="";
	function createXMLHttpRequest()
	{
		if(window.ActiveXObject)
		{
			xhr = new ActiveXObject("Microsoft.XMLHTTP");
		}
		else if(window.XMLHttpRequest)
		{
			xhr = new XMLHttpRequest();
		}
	}

	function changePic(id,img,input){
		 load = layer.load(1, {
			shade: [0.1,'#fff'] //0.1透明度的白色背景
		});
		returnimg=img;	//	展示图片
		returninput=input;	//存放表单提交值

		var fileObj = document.getElementById(id).files[0];
		var FileController = $("#"+id).attr("data-src");
		var form = new FormData();
		form.append("file", fileObj);
		createXMLHttpRequest();
		xhr.onreadystatechange = handleStateChange;
		xhr.open("post", FileController, true);
		xhr.send(form);
	}

	function changeFile(id){
		load = layer.load(1, {
			shade: [0.1,'#fff'] //0.1透明度的白色背景
		});
		var fileObj = document.getElementById(id).files[0];
		var FileController = $("#"+id).attr("data-src");
		var form = new FormData();
		form.append("file", fileObj);
		createXMLHttpRequest();
		xhr.onreadystatechange = handleStateChange;
		xhr.open("post", FileController, true);
		xhr.send(form);
	}

	function handleStateChange()
	{
		if(xhr.readyState == 4)
		{
			layer.close(load);
			if (xhr.status == 200 || xhr.status == 0)
			{

				var result = xhr.responseText;
				var json = eval("(" + result + ")");
				if(json.success){
					$("#"+returninput).val(json.data);
					$("#"+returnimg).attr("src","<?php echo e(url('/uploads/pic')); ?>"+'/'+json.data);
					$("#"+returnimg).show();
				}
				else{
					layer.alert(json.msg);
				}
			}
		}
	}

	function changePics(id){
		load = layer.load(1, {
			shade: [0.1,'#fff'] //0.1透明度的白色背景
		});
		var fileObj = document.getElementById(id).files[0];
		var FileController = $("#"+id).attr("data-src");
		var form = new FormData();
		form.append("file", fileObj);
		createXMLHttpRequest();
		xhr.onreadystatechange = uploadMultiFile;
		xhr.open("post", FileController, true);
		xhr.send(form);
	}

	function uploadMultiFile(){
		console.log(xhr.readyState);
		var picPath = "<?php echo e(url('/uploads/pic/temp')); ?>";
		if(xhr.readyState == 4)
		{
			layer.close(load);
			if (xhr.status == 200 || xhr.status == 0)
			{
				var result = xhr.responseText;
				var json = eval("(" + result + ")");
				if(json.success){
					var html="<li class='pic_list_li'>" +
							"<img src="+picPath+'/'+json.data+" width='80px' height='80px'  class='pic_list_one' >" +
							"<input type='hidden' name='pic_url[]' value="+json.data+" class='pic_one'>" +
							"<p onclick=\"remove_li($(this))\">移除</p>" +
							"</li>";
					$(".pic_list").append(html);
				}
				else{
					layer.alert(json.msg);
				}
			}
		}
	}

	function remove_li(this_p){
		this_p.parents(".pic_list_li").remove();
	}
</script>

<title><?php echo $__env->yieldContent('title'); ?></title>
<?php $__env->startSection('addcss'); ?>
<?php echo $__env->yieldSection(); ?>
		<!-- 自定义样式 -->
</head>

<body>
<?php $__env->startSection('content'); ?>
<?php echo $__env->yieldSection(); ?>
</body>
<?php $__env->startSection('addscript'); ?>
<?php echo $__env->yieldSection(); ?>
<script>
	document.fullscreenEnabled ? fullscreenEnabled = document.fullscreenEnabled : document.mozFullScreenEnabled ? fullscreenEnabled = document.mozFullScreenEnabled : document.webkitFullscreenEnabled ?  fullscreenEnabled = document.webkitFullscreenEnabled : document.msFullscreenEnabled ? fullscreenEnabled = document.msFullscreenEnabled : fullscreenEnabled = false;
		console.log(fullscreenEnabled)
</script>
</html>
